#include <iostream>
#include <assert.h>

#include "base/logging.h"
#include "redis_executor/redis_executor.h"
#include "redis_executor/scoped_reply.h"

using namespace std;

int main() {
  RedisExecutor exec;
  LOG_INIT("./redis_protocol_test.log", "DEBUG");

  //TODO: 引入单元测试框架
  ScopedReply null_reply(NULL);
  assert(!null_reply);

  ScopedReply reply(exec.Execute("", "SADD article:comment:%s %s", "107", "6"));
  if (reply) {
    if (reply->type == REDIS_REPLY_INTEGER) {
       cout << "reply:" << reply->integer << endl;
    } else {
       cout << "bad reply type:" << reply->type << endl;
    }
  } else {
    cout << "null reply, may be connection err." << endl;
  }

  return 0;
}

